/**
 * Copyright (C), 2019-2020, 宇信融汇
 * FileName: TestMotovehicle
 * Author:   xbliu
 * Date:     2020/6/28 15:18
 * Description:
 * History:
 * <author>          <time>          <version>          <desc>
 * xbliu           修改时间           版本号              描述
 */
package c_005;

/**
 * @Classname TestMotovehicle
 * @Description TODO
 * @Date 2020/6/28 15:18
 * @Created by xbliu
 */
public class  TestMotovehicle {
    public static void main(String[] args) {
//        Car car1 = new Car(1, "宝马", "1");
//        System.out.println(car1.calcRent(20));
//        Bus bus1 = new Bus(1, "金龙", 16);
//        System.out.println(bus1.calcRent(2));
        MotoVehicle moto[] = new MotoVehicle[5];
        moto[0]=new Car(1, "宝马", "1");
        moto[1]=new Car(2, "奥迪", "2");
        moto[2]=new Car(3, "别克", "3");
        moto[3]=new Bus(4, "金龙", 34);
        moto[4]=new Bus(5, "大卡车", 50);
       int totalMoney= calcTotalMoney(moto);
        System.out.println("总金额："+totalMoney);
    }
    public  static  int calcTotalMoney( MotoVehicle moto[]){
        int totalMoney = 0;
        for (int i = 0; i < moto.length ;i++) {
            totalMoney += moto[i].calcRent(5);
        }
        return totalMoney;
    }
}
